<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>网易云飙升榜歌曲</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            background-color: #f8f8f8;
            margin: 0;
            padding: 0;
        }
        .container {
            max-width: 800px;
            margin: 20px auto;
            padding: 20px;
            background-color: #fff;
            border-radius: 5px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
        }
        h1, h2, h3 {
            color: #333;
        }
        img {
            max-width: 100%;
            height: auto;
            margin-bottom: 10px;
        }
        .song-info {
            margin-bottom: 20px;
        }
        .song-info p {
            margin: 5px 0;
        }
        .song-info img {
            max-width: 200px;
            height: auto;
            margin-right: 10px;
        }
        .song-info a {
            color: #007bff;
            text-decoration: none;
        }
        .song-info a:hover {
            text-decoration: underline;
        }
    </style>
</head>
<body>
<div class="container">
    <h1>网易云飙升榜歌曲</h1>
    <div class="song-info" id="song-info">
        <p>Loading...</p>
    </div>
    <button onclick="fetchSong()">获取歌曲信息</button>
</div>

<script>
    function fetchSong() {
        const songInfoDiv = document.getElementById('song-info');
        songInfoDiv.innerHTML = '<p>Loading...</p>';

        fetch('https://api.vvhan.com/api/wyMusic/热歌榜?type=json')
            .then(response => response.json())
            .then(data => {
                if (data.success) {
                    const songData = data.info;
                    const songInfoHTML = `
                            <img src="${songData.picUrl}" alt="歌曲封面" />
                            <p><strong>歌曲名称：</strong>${songData.name}</p>
                            <p><strong>歌手：</strong>${songData.auther}</p>
                            <p><a href="${songData.url}" target="_blank">播放歌曲</a></p>
                        `;
                    songInfoDiv.innerHTML = songInfoHTML;
                } else {
                    songInfoDiv.innerHTML = '<p>Failed to fetch song information.</p>';
                }
            })
            .catch(error => {
                console.error('Error fetching song:', error);
                songInfoDiv.innerHTML = '<p>Failed to fetch song information.</p>';
            });
    }
</script>
</body>
</html>
